package com.hainabo.mgcmall.dao;

import com.hainabo.mgcmall.model.DriversLicenseInfo;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by guoshihao on 2017/11/29.
 */
public interface DriversLicenseRespository extends PagingAndSortingRepository<DriversLicenseInfo, Long> {

    @Modifying
    @Transactional
    @Query(value = "UPDATE t_drivers_license_info set state = :state where id = :id")
    public void updateState(@Param("state")int state,@Param("id")long id);

    public DriversLicenseInfo findByUserId(Long userId);
}
